package cn.waqwb;

import javax.servlet.ServletException;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author JokerQ
 * @date 2020/8/5 - 17:33
 */
public class FirstServlet extends javax.servlet.http.HttpServlet {

    @Override
    public void init() throws ServletException {
        System.out.println("Servlet的init方法执行了！！！");
    }

    @Override
    protected void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter printWriter = response.getWriter();
        printWriter.println("<h1>你好</h1>");
        printWriter.close();
    }

    @Override
    public void destroy() {
        System.out.println("Servlet被销毁了！！！");
    }
}
